package gui.toolbar;

import gui.view.standard.ViewTriggers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JToggleButton;
import javax.swing.JToolBar;

public class SelectionToolBar extends JToolBar{
	
	public SelectionToolBar() {
		add(new TunnelSelectionButton());
		add(new StationSelectionButton());
	}
	class TunnelSelectionButton extends JToggleButton {
		public TunnelSelectionButton() {
			super("Select tunnels");
			this.setSelected(true);
			setFocusable(false);
			addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {					
					ViewTriggers.tunnelSelectingEnabled = TunnelSelectionButton.this.isSelected();
					
				}
				
			});
		}
	}
	class StationSelectionButton extends JToggleButton {
		public StationSelectionButton() {
			super("Select stations");
			this.setSelected(true);
			setFocusable(false);
			addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {					
					ViewTriggers.stationSelectingEnabled = StationSelectionButton.this.isSelected();
					
				}
				
			});
		}
	}
}
